<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>站点后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/res/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/res/adminui/dist/css/admin.css" media="all">
    <style>
        .layui-layout .layui-categories-tree {
            background: #fff;
            top: 15px;
            overflow-x: hidden;
            font-size: 12px;
        }

        .layui-tree-icon {
            margin-right: 14px;
        }

        .custom-tree-item-clicked > .layui-tree-entry .layui-tree-txt {
            background-color: #FFE6B0;
            border: 1px #FFB951 solid;
        }
    </style>
</head>
<body>
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-side layui-side-menu layui-categories-tree">
            <div class="layui-card-header">全部栏目</div>
            <div id="categories" class="categories-tree"></div>
        </div>

        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body" style="top: 15px ">
            <div class="layadmin-tabsbody-item layui-show" style="top: 0px">
                <iframe src="{:url('index/console')}?list=1&website_code={$websiteCode}" frameborder="0" class="layadmin-iframe"></iframe>
            </div>
        </div>
    </div>


</div>


<script src="__STATIC__/res/layui/layui.js"></script>
<script>
    var ARTICLE_LIST_URL = '{:url("article/lists")}'
    layui.use(['tree', 'util', 'jquery'], function () {
        var enterprises = JSON.parse('{$categories|raw}')
        var tree = layui.tree
            , $ = layui.$
            , layer = layui.layer
            , util = layui.util
            , data = enterprises;

        var iframe = $.find('.layadmin-iframe');
        tree.render({
            elem: '#categories'
            , onlyIconControl: true
            , data: data
            , click: function (obj) {
                $('.layui-tree .layui-tree-set').removeClass('custom-tree-item-clicked');
                $(obj.elem[0]).addClass('custom-tree-item-clicked');
                iframe[0].contentWindow.location.href = ARTICLE_LIST_URL + "?category_id=" + obj.data.id + '&list=1&website_code={$websiteCode}'
            }
        });

    });
</script>

</body>
</html>